#!/bin/bash
# 定义容器名称变量
CONTAINER_NAME="ruffle_player_container"
# 定义镜像名称变量
IMAGE_NAME="ruffle_player_image"
# 判断旧容器是否存在并删除
if docker ps -a | grep -q "$CONTAINER_NAME"; then
    docker rm $CONTAINER_NAME
    echo "旧容器已删除"
else
    echo "旧容器不存在"
fi
# 判断旧镜像是否存在并删除
if docker images | grep -q "$IMAGE_NAME"; then
    docker rmi $IMAGE_NAME
    echo "旧镜像已删除"
else
    echo "旧镜像不存在"
fi
# 构建镜像
#  docker build --progress=plain -t $IMAGE_NAME .
docker build -t $IMAGE_NAME .
# 主机端口10011对应docker内端口3000
docker run -d -p 10011:80 --name $CONTAINER_NAME $IMAGE_NAME
#  docker run -it -p 10011:80 --name $CONTAINER_NAME $IMAGE_NAME /bin/sh
